package models

import "gorm.io/gorm"

type Novels struct {
	gorm.Model
	Title  string  `gorm:"type:varchar(255);not null;commit:'标题'"`
	Writer string  `gorm:"type:varchar(50);not null;commit:'作者'"`
	Hot    int64   `gorm:"type:int(50);not null;commit:'热度'"`
	Image  string  `gorm:"type:varchar(150);not null;commit:'图片'"`
	Price  float64 `gorm:"type:decimal(10,2);not null;commit:'价格'"`
	Num    int64   `gorm:"type:int;not null;commit:'数量'"`
}

func (n *Novels) NovelAdd() error {
	return DB.Debug().Create(&n).Error
}
